package com.oe.ldm.service.impl;

import com.oe.ldm.dao.ArticleDao;
import com.oe.ldm.pojo.Article;
import com.oe.ldm.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    ArticleDao articleDao;

    @Override
    public Page<Article> queryPage(int pageNo, int pageSize) {
        Page<Article> page = articleDao.findAll(PageRequest.of(pageNo, pageSize, Sort.by(Sort.Direction.DESC, "created")));
        return page;
    }
}
